
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta charset="utf-8" />
    <title>Dispersed Phases User’s Guide &#8212; Texas A&amp;M Oil spill / Outfall Calculator 2.1.0 documentation</title>
    <link rel="stylesheet" href="../_static/alabaster.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
    <script src="../_static/jquery.js"></script>
    <script src="../_static/underscore.js"></script>
    <script src="../_static/doctools.js"></script>
    <script src="../_static/language_data.js"></script>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="Sintef Module User’s Guide" href="sintef.html" />
    <link rel="prev" title="hydrocarbon_drops" href="../scripts/dbm/hydrocarbon_drops.html" />
   
  <link rel="stylesheet" href="../_static/custom.css" type="text/css" />
  
  
  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />

  </head><body>
  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          

          <div class="body" role="main">
            
  <div class="section" id="dispersed-phases-user-s-guide">
<h1>Dispersed Phases User’s Guide<a class="headerlink" href="#dispersed-phases-user-s-guide" title="Permalink to this headline">¶</a></h1>
<dl class="field-list simple">
<dt class="field-odd">Release</dt>
<dd class="field-odd"><p>2.1</p>
</dd>
<dt class="field-even">Date</dt>
<dd class="field-even"><p>Jun 05, 2020</p>
</dd>
</dl>
<div class="section" id="scripts">
<h2>Scripts<a class="headerlink" href="#scripts" title="Permalink to this headline">¶</a></h2>
<p>The class objects and method functions defined in the <cite>dispersed_phases</cite>
module provide provide an interface to the <cite>dbm</cite> objects, methods, and
functions through the definition of two new objects: the <cite>SingleParticle</cite>
object, used to describe one particle, and the <cite>PlumeParticle</cite> object used to
describe one group of particle in a plume model simulation. These functions
are almost never used alone, but rather as part of a model simulation. To see
examples of how these are used in the context of the various models, see the
scripts in <code class="docutils literal notranslate"><span class="pre">./bin/sbm</span></code>, <code class="docutils literal notranslate"><span class="pre">./bin/spm</span></code>, and <code class="docutils literal notranslate"><span class="pre">./bin/bpm</span></code>.</p>
<p>The <cite>bent_plume_model</cite> contains one more object, the <cite>bent_plume_model.Particle</cite>
object, which inherits the <cite>PlumeParticle</cite> object and adds functionality for
particle tracking within the Lagrangian plume model solution.</p>
</div>
<div class="section" id="examples">
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline">¶</a></h2>
<p>This example illustrates the tasks involved in using the <cite>PlumeParticle</cite>
object to create a set of particles that will eventually be used by the
<cite>stratified_plume_model</cite>. The procedure is similar for the other objects in
this module, as well as for the <cite>bent_plume_model.Particle</cite> object.</p>
<p>Before running these examples, be sure to install the <code class="docutils literal notranslate"><span class="pre">TAMOC</span></code> package and
run all of the tests in the <code class="docutils literal notranslate"><span class="pre">./test</span></code> directory. The commands below should be
executed in an IPython session. Start IPython by executing:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ipython</span> <span class="o">--</span><span class="n">pylab</span>
</pre></div>
</div>
<p>at the command prompt.  The <code class="docutils literal notranslate"><span class="pre">--pylab</span></code> flag is needed to get the correct
behavior of the output plots.</p>
<p>The first step in any spill simulation is to define the ambient CTD data. The
<code class="docutils literal notranslate"><span class="pre">TAMOC</span></code> module <cite>ambient</cite> provides the tools needed to read in CTD data from
text files and organize it into the netCDF files used by the <code class="docutils literal notranslate"><span class="pre">TAMOC</span></code>
simulation modules. Examples of how to do this are provided in the
<code class="docutils literal notranslate"><span class="pre">./bin/ambient</span></code> directory of the TAMOC distribution. Here, we use the CTD
data created by the <code class="docutils literal notranslate"><span class="pre">TAMOC</span></code> test files and stored in the <code class="docutils literal notranslate"><span class="pre">./test/output</span></code>
directory. Open a CTD file as follows (path names in this tutorial are from
any subdirectory of the <code class="docutils literal notranslate"><span class="pre">TAMOC</span></code> source distribution, e.g.,
<code class="docutils literal notranslate"><span class="pre">./notebooks</span></code>):</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">ctd_file</span> <span class="o">=</span> <span class="s1">&#39;../test/output/test_BM54.nc&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">ctd</span> <span class="o">=</span> <span class="n">ambient</span><span class="o">.</span><span class="n">Profile</span><span class="p">(</span><span class="n">ctd_file</span><span class="p">,</span> <span class="n">chem_names</span><span class="o">=</span><span class="s1">&#39;all&#39;</span><span class="p">)</span>
</pre></div>
</div>
<p>These various particle objects are typically supplied to the models as a list.
For this example, begin with an empty list:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">particles</span> <span class="o">=</span> <span class="p">[]</span>
</pre></div>
</div>
<div class="section" id="gas-bubbles">
<h3>Gas Bubbles<a class="headerlink" href="#gas-bubbles" title="Permalink to this headline">¶</a></h3>
<p>For a blowout, we might expect both gas and oil.  Here, we create a few
gas bubbles to add to the simulation.  The first step is to create a <cite>dbm</cite>
particle object.  In this case, we choose a dissolvable particle of natural
gas:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">composition</span> <span class="o">=</span> <span class="p">[</span><span class="s1">&#39;methane&#39;</span><span class="p">,</span> <span class="s1">&#39;ethane&#39;</span><span class="p">,</span> <span class="s1">&#39;propane&#39;</span><span class="p">,</span> <span class="s1">&#39;oxygen&#39;</span><span class="p">]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">mol_frac</span> <span class="o">=</span> <span class="p">[</span><span class="mf">0.93</span><span class="p">,</span> <span class="mf">0.05</span><span class="p">,</span> <span class="mf">0.02</span><span class="p">,</span> <span class="mf">0.0</span><span class="p">]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">gas</span> <span class="o">=</span> <span class="n">dbm</span><span class="o">.</span><span class="n">FluidParticle</span><span class="p">(</span><span class="n">composition</span><span class="p">)</span>
</pre></div>
</div>
<p>Next, we have to get the mass of each component in a single bubble and the
total bubble flux. A helper function is provided in the <code class="docutils literal notranslate"><span class="pre">TAMOC</span></code> model called
<cite>dispersed_phases.initial_conditions</cite>. Here, we use the function to create six
different sized bubbles:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">x0</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mf">0.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">1000.</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">T0</span> <span class="o">=</span> <span class="mf">273.15</span> <span class="o">+</span> <span class="mf">30.</span>
<span class="gp">&gt;&gt;&gt; </span><span class="c1"># Initial bubble diameter (m)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">de</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mf">0.04</span><span class="p">,</span> <span class="mf">0.03</span><span class="p">,</span> <span class="mf">0.02</span><span class="p">,</span> <span class="mf">0.01</span><span class="p">,</span> <span class="mf">0.0075</span><span class="p">,</span> <span class="mf">0.005</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="c1"># Total mass flux (kg/s) of gas in each bubble size class</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">m0</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mf">0.5</span><span class="p">,</span> <span class="mf">1.5</span><span class="p">,</span> <span class="mf">2.5</span><span class="p">,</span> <span class="mf">3.5</span><span class="p">,</span> <span class="mf">1.5</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">]</span> <span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="c1"># Associate spreading ratio (--)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">lambda_1</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mf">0.75</span><span class="p">,</span> <span class="mf">0.8</span><span class="p">,</span> <span class="mf">0.85</span><span class="p">,</span> <span class="mf">0.9</span><span class="p">,</span> <span class="mf">0.9</span><span class="p">,</span> <span class="mf">0.95</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="c1"># Append to the disp_phases list</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">de</span><span class="p">)):</span>
<span class="go">        m, T, nb, P, Sa, Ta = dispersed_phases.initial_conditions(</span>
<span class="go">            ctd, x0[2], gas, mol_frac, m0[i], 2, de[i], T0)</span>
<span class="go">        particles.append(dispersed_phases.PlumeParticle(gas, m, T, nb,</span>
<span class="go">            lambda_1[i], P, Sa,  Ta))</span>
</pre></div>
</div>
</div>
<div class="section" id="oil-droplets">
<h3>Oil Droplets<a class="headerlink" href="#oil-droplets" title="Permalink to this headline">¶</a></h3>
<p>Following the same procedure as for the gas but with different equations of
state, liquid droplets can be added to the simulation. Start, by defining a
new set of equations of state. Here, we assume a non-dissolving oil phase:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">composition</span> <span class="o">=</span> <span class="p">[</span><span class="s1">&#39;inert&#39;</span><span class="p">]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rho_o</span> <span class="o">=</span> <span class="mf">890.</span>     <span class="c1"># density in kg/m^3</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">gamma</span> <span class="o">=</span> <span class="mf">30.</span>      <span class="c1"># API gravity in deg API</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">beta</span> <span class="o">=</span> <span class="mf">0.0007</span>    <span class="c1"># thermal expansion coefficient in K^(-1)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">co</span> <span class="o">=</span> <span class="mf">2.90075e-9</span>  <span class="c1"># isothermal compressibility coefficient in Pa^(-1)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">oil</span> <span class="o">=</span> <span class="n">dbm</span><span class="o">.</span><span class="n">InsolubleParticle</span><span class="p">(</span><span class="kc">True</span><span class="p">,</span> <span class="kc">True</span><span class="p">,</span> <span class="n">rho_o</span><span class="p">,</span> <span class="n">gamma</span><span class="p">,</span> <span class="n">beta</span><span class="p">,</span> <span class="n">co</span><span class="p">)</span>
</pre></div>
</div>
<p>Then, define the droplet characteristics and append them to the
<code class="docutils literal notranslate"><span class="pre">particles</span></code> list as we did for the gas bubbles. Note that all particles go
in the same list and could be in any order:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">de</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mf">0.02</span><span class="p">,</span> <span class="mf">0.01</span><span class="p">,</span> <span class="mf">0.0075</span><span class="p">,</span> <span class="mf">0.005</span><span class="p">,</span> <span class="mf">0.003</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">m0</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mf">1.</span><span class="p">,</span> <span class="mf">2.5</span><span class="p">,</span> <span class="mf">5.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">lambda_1</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mf">0.85</span><span class="p">,</span> <span class="mf">0.90</span><span class="p">,</span> <span class="mf">0.95</span><span class="p">,</span> <span class="mf">0.95</span><span class="p">,</span> <span class="mf">1.</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">de</span><span class="p">)):</span>
<span class="go">        m, T, nb, P, Sa, Ta = dispersed_phases.initial_conditions(</span>
<span class="go">            ctd, x0[2], oil, 1., m0[i], 2, de[i], T0)</span>
<span class="go">        particles.append(dispersed_phases.PlumeParticle(oil, m, T, nb,</span>
<span class="go">            lambda_1[i], P, Sa, Ta))</span>
</pre></div>
</div>
</div>
</div>
</div>


          </div>
          
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="../index.html">Texas A&M Oil spill / Outfall Calculator</a></h1>








<h3>Navigation</h3>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../user_manual.html">TAMOC User Manual</a></li>
<li class="toctree-l1"><a class="reference internal" href="../unit_tests.html">Unit Tests</a></li>
<li class="toctree-l1"><a class="reference internal" href="../glossary.html">Glossary</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../bugs.html">Reporting Bugs</a></li>
<li class="toctree-l1"><a class="reference internal" href="../readme.html">Read Me File</a></li>
<li class="toctree-l1"><a class="reference internal" href="../release.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference internal" href="../license.html">License</a></li>
</ul>

<div class="relations">
<h3>Related Topics</h3>
<ul>
  <li><a href="../index.html">Documentation overview</a><ul>
  <li><a href="../user_manual.html">TAMOC User Manual</a><ul>
      <li>Previous: <a href="../scripts/dbm/hydrocarbon_drops.html" title="previous chapter">hydrocarbon_drops</a></li>
      <li>Next: <a href="sintef.html" title="next chapter">Sintef Module User’s Guide</a></li>
  </ul></li>
  </ul></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" />
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script>$('#searchbox').show(0);</script>








        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="footer">
      &copy;2020, Scott A. Socolofsky.
      
      |
      Powered by <a href="http://sphinx-doc.org/">Sphinx 2.4.4</a>
      &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
      
      |
      <a href="../_sources/guides/disp_phases.rst.txt"
          rel="nofollow">Page source</a>
    </div>

    

    
  </body>
</html>